<?php 
include "../inc-config.php";
echo "<div align='center' class='links2'>";
$OrderNews = "SELECT COUNT(*) from b_comments where newsid=$news order by timepost DESC";
$OrderNews2 = mysql_query($OrderNews, $forum);
$d = 0;
$f = 0;
$g = 1;
$order3 = mysql_result($order2, 0);
$start = $_GET['page'];
$prev = $start - $limit;
$next = $start + $limit;
if($start>=$limit)
{
?>
<a href="javascript:get('<?php echo $sitepath; ?>news.php?news=<?php echo $news; ?>&page=0', 'news');" >First</a>&nbsp&nbsp;&nbsp; 
<a href="javascript:get('<?php echo $sitepath; ?>news.php?news=<?php echo $news; ?>&page=<?php echo $prev; ?>', 'news');" ><<</a>&nbsp;
<?php
}
while($f < $order3)
{
	if($f % $limit == 0)
	{
		if($f >= $start - 3 * $limit && $f <= $start + 7 * $limit)
		{
?>
<a href="javascript:get('<?php print "$sitepath"; ?>news.php?news=<?php print "$news" ?>&page=<?php print "$d" ?>', 'news');" >
<?php
			echo "$g</a> ";
			$g++;
		}
	}
	$d++;
	$f++;
}
if($start <= $order3 - $limit)
{
?>
<a href="javascript:get('<?php echo $sitepath; ?>news.php?news=<?php echo $news; ?>&page=<?php echo $next; ?>', 'news');" >
>></a>&nbsp;&nbsp;&nbsp;
<?php
$last = $order3 - $limit;
?>
<a href="javascript:get('<?php echo $sitepath; ?>news.php?news=<?php echo $news; ?>&page=<?php echo $last; ?>', 'news');" >
Last</a>&nbsp;&nbsp;&nbsp;
<?php
}  
echo "</div>";
?>